package com.jingdianjichi.club.gateway.enums;

import lombok.Getter;

@Getter
public enum ResultCodeEnum {

    SUCCESS(200, "成功"),

    FAIL(500, "失败"),

    //UNAUTHORIZED(401, "未认证"),

    NOT_FOUND(404, "接口不存在");

    //INTERNAL_SERVER_ERROR(500, "服务器内部错误");

    private int code;

    private String desc;

    ResultCodeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ResultCodeEnum getBycode(int codeVal) {
        for (ResultCodeEnum resultCodeEnum : ResultCodeEnum.values()) {
            if (resultCodeEnum.getCode() == codeVal) {
                return resultCodeEnum;
            }
        }
        return null;
    }
}
